#coding:utf-8
'''
运算符重载
Python中，类支持运算符重载
'''
class Test:
    def __init__(self,a,b):
        self.a = a 
        self.b = b 
    def __str__(self):
        #在打印对象时调用此方法  print(obj)
        return 'Test(%d,%d)' %(self.a,self.b)
    def __add__(self,other):
        return Test(self.a+other.a,self.b+other.b)
t1 = Test(3,4)
t2 = Test(5,6)
t3 = t1+t2  # t3=Test(8,10)
print(t3)   